{
语法百题 解题报告：
 http://git.oschina.net/et0662/sznoi-grammar/ 
}
var
	a,b,c:integer;
	maxa,maxb,maxc:integer;
	ta,tb,tc:integer;
	i,n:integer;
begin
	readln(a);
	readln(b);
	readln(c);
	maxa:=a;
	maxb:=b;
	maxc:=c;
	readln(n);
	for i:=1 to n do
	begin
		readln(ta);
		readln(tb);
		readln(tc);
		if(maxa<ta)then maxa:=ta;
		if(maxb<tb)then maxb:=tb;
		if(maxc<tc)then maxc:=tc;
	end;
	writeln(maxa-a,' ',maxb-b,' ',maxc-c);
end.
